<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
		<style type="text/css">
			body, html {
				width: 100%;
				height: 100%;
				overflow: hidden;
				margin: 0;
			}
			#allmap {
				/*margin-right: 300px;*/
				height: 100%;
				overflow: hidden;
			}
			#result {
				border-left: 1px dotted #999;
				height: 100%;
				width: 295px;
				position: absolute;
				top: 0px;
				right: 0px;
				font-size: 12px;
			}
			dl, dt, dd, ul, li {
				margin: 0;
				padding: 0;
				list-style: none;
			}
			dt {
				font-size: 14px;
				font-family: "微软雅黑";
				font-weight: bold;
				border-bottom: 1px dotted #000;
				padding: 5px 0 5px 5px;
				margin: 5px 0;
			}
			dd {
				padding: 5px 0 0 5px;
			}
			li {
				line-height: 28px;
			}
		</style>
		<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Ftjw57bmpZceTKk6QSe08GtA"></script>
		<script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
		<link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />

		<title>加油站百度地图定位</title>
		
		<script>
			var $search = decodeURI(location.search.substring(1));
			var $lon = $search.substring($search.indexOf("lon") + 4, ($search.indexOf("&") > 0) ? ($search.indexOf("&")) : ($search.length));
			$search = $search.substring($search.indexOf("&") + 1, $search.length);
			var $lat = $search.substring($search.indexOf("lat") + 4, ($search.indexOf("&") > 0) ? ($search.indexOf("&")) : ($search.length));
			$search = $search.substring($search.indexOf("&") + 1, $search.length);
			var $title = $search.substring($search.indexOf("title") + 6, ($search.indexOf("&") > 0) ? ($search.indexOf("&")) : ($search.length));
			$search = $search.substring($search.indexOf("&") + 1, $search.length);
			var $addr = $search.substring($search.indexOf("addr") + 5, ($search.indexOf("&") > 0) ? ($search.indexOf("&")) : ($search.length));
			$search = $search.substring($search.indexOf("&") + 1, $search.length);
			var $desc = $search.substring($search.indexOf("desc") + 5, ($search.indexOf("&") > 0) ? ($search.indexOf("&")) : ($search.length));
			$search = $search.substring($search.indexOf("&") + 1, $search.length);

			var info = {
				longitude : $lon,
				latitude : $lat,
				title : $title,
				addr : $addr,
				desc : $desc
			}

            window.onload = function () {
                document.getElementById("BMapLib_sendToPhone0").style.display = "none";
            }
		</script>
		
	</head>
	<body>
		<div id="allmap" style="overflow:hidden;zoom:1;position:relative;">
			<div id="map" style="width: 100%;height:100%;-webkit-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;"></div>
			<div id="showPanelBtn" style="display: none;position:absolute;font-size:14px;top:50%;margin-top:-95px;right:0px;width:20px;padding:10px 10px;color:#999;cursor:pointer;text-align:center;height:170px;background:rgba(255,255,255,0.9);-webkit-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;font-family:'微软雅黑';font-weight:bold;">
				显示检索结果面板
				<br/>
				&lt;
			</div>
			<div id="panelWrap" style="display: none;width:0px;position:absolute;top:0px;right:0px;height:100%;overflow:auto;-webkit-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;">
				<div style="width:20px;height:200px;margin:-100px 0 0 -10px;color:#999;position:absolute;opacity:0.5;top:50%;left:50%;">
					此处用于展示结果面板
				</div>
				<div id="panel" style="position:absolute;"></div>
			</div>
		</div>

		<script type="text/javascript">
			// 百度地图API功能
			var map = new BMap.Map('map');
			var poi = new BMap.Point(info.longitude, info.latitude);
			map.centerAndZoom(poi, 16);
			map.enableScrollWheelZoom();
			map.enableContinuousZoom();// 开启连续缩放效果
			map.enableInertialDragging();// 开启惯性拖拽效果
			map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件

			var content = '<div style="margin:0;line-height:20px;padding:2px;">' + '地址：'+info.addr+'<br/>简介：'+info.desc;

			//创建检索信息窗口对象
			var searchInfoWindow = null;
			searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
				title : info.title, //标题
				width : 50, //宽度
				height : "auto", //高度
				panel : "panel", //检索结果面板
				enableAutoPan : true, //自动平移
				searchTypes : [BMAPLIB_TAB_SEARCH, //周边检索
				BMAPLIB_TAB_TO_HERE, //到这里去
				BMAPLIB_TAB_FROM_HERE //从这里出发
				]
			});
			var marker = new BMap.Marker(poi);
			//创建marker对象
			marker.enableDragging();
			//marker可拖拽
			marker.addEventListener("click", function(e) {
				searchInfoWindow.open(marker);
			})
			map.addOverlay(marker);
			//在地图中添加marker
			searchInfoWindow.open(marker);
		</script>

	</body>
</html>
